package com.wbao.dianniu.update;

import java.util.ArrayList;
import java.util.List;

import com.wbao.dianniu.listener.IHeadImageListener;

public class HeadImageManger {

    private static HeadImageManger instance;
    private static List<IHeadImageListener> mList;

    public static HeadImageManger getInstance() {
        if (null == instance) {
            instance = new HeadImageManger();
            mList = new ArrayList<IHeadImageListener>();
        }
        return instance;
    }


    public void addListener(IHeadImageListener listener) {
        mList.add(listener);
    }

    public void removeListener(IHeadImageListener listener) {
        mList.remove(listener);
    }

    public void removeAllListener() {
        mList = null;
    }

    public void changeImageData(String headCachePath) {
        for (int i = 0; i < mList.size(); i++) {
            mList.get(i).imageChange(headCachePath);
        }
    }

    public void changeDatas(String nickName, String headPic, String sex, String signate, String label) {
        for (int i = 0; i < mList.size(); i++) {
            mList.get(i).dataChanged(nickName, headPic, sex, signate, label);
        }
    }

    public void partnerNotify(int partner) {
        for (int i = 0; i < mList.size(); i++) {
            mList.get(i).partnerNotify(partner);
        }
    }

}
